/*
 * @Author: 2112778581 2112778581@qq.com
 * @Date: 2023-10-17 11:58:33
 * @LastEditors: fengshan525 2735332396@qq.com
 * @LastEditTime: 2025-09-21 16:56:46
 * @FilePath: \cra-front\src\api\content\product.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/api/request'

// 产品列表
export const getProjectList = (data: any): any => {
  return request.post('/list-detail/findAll', data)
}

// 编辑产品
export const editProjectApi = (id: string, data: any): any => {
  return request.post(`/list-detail/update/${id}`, data)
}
// 新增产品
export const addProjectApi = (data: any): any => {
  return request.post('/list-detail', data)
}

// 删除产品
export const delProjectApi = (id: string): any => {
  return request.delete(`/list-detail/${id}`)
}

// 获取产品下拉列表
export const getProjDropdownList = (): Promise<any> => {
  return request.post('/list-detail/getDropdownList')
}

// 查找单个产品
export const getProjectById = (id: any): any => {
  return request.get(`/list-detail/getById/${id}`)
}

// 根据linkName查找产品，判断是否linkName冲突
export const getDetailByLinkName = (linkName: string): Promise<any> => {
  return request.get<any>('/list-detail/getDetailByLinkName/' + linkName)
}

export const getCategoryCount = (data: any) => {
  return request.post<any>('/list-detail/getCategoryCount', data)
}
